.\" Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
.\"
.\" This code is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License version 2 only, as
.\" published by the Free Software Foundation.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
.\" or visit www.oracle.com if you need additional information or have any
.\" questions.
.\"
.\" Automatically generated by Pandoc 2.3.1
.\"
.TH "JDEPS" "1" "2021" "JDK 17" "JDK Commands"
.hy
.SH NAME
.PP
jdeps \- launch the Java class dependency analyzer
.SH SYNOPSIS
.PP
\f[CB]jdeps\f[R] [\f[I]options\f[R]] \f[I]path\f[R] ...
.TP
.B \f[I]options\f[R]
Command\-line options.
For detailed descriptions of the options that can be used, see
.RS
.IP \[bu] 2
\f[B]Possible Options\f[R]
.IP \[bu] 2
\f[B]Module Dependence Analysis Options\f[R]
.IP \[bu] 2
\f[B]Options to Filter Dependences\f[R]
.IP \[bu] 2
\f[B]Options to Filter Classes to be Analyzed\f[R]
.RE
.TP
.B \f[I]path\f[R]
A pathname to the \f[CB]\&.class\f[R] file, directory, or JAR file to
analyze.
.RS
.RE
.SH DESCRIPTION
.PP
The \f[CB]jdeps\f[R] command shows the package\-level or class\-level
dependencies of Java class files.
The input class can be a path name to a \f[CB]\&.class\f[R] file, a
directory, a JAR file, or it can be a fully qualified class name to
analyze all class files.
The options determine the output.
By default, the \f[CB]jdeps\f[R] command writes the dependencies to the
system output.
The command can generate the dependencies in DOT language (see the
\f[CB]\-dotoutput\f[R] option).
.SH POSSIBLE OPTIONS
.TP
.B \f[CB]\-?\f[R] or \f[CB]\-h\f[R] or \f[CB]\-\-help\f[R]
Prints the help message.
.RS
.RE
.TP
.B \f[CB]\-dotoutput\f[R] \f[I]dir\f[R] or \f[CB]\-\-dot\-output\f[R] \f[I]dir\f[R]
Specifies the destination directory for DOT file output.
If this option is specified, then the \f[CB]jdeps\f[R]command generates
one \f[CB]\&.dot\f[R] file for each analyzed archive named
\f[CB]archive\-file\-name.dot\f[R] that lists the dependencies, and also a
summary file named \f[CB]summary.dot\f[R] that lists the dependencies
among the archive files.
.RS
.RE
.TP
.B \f[CB]\-s\f[R] or \f[CB]\-summary\f[R]
Prints a dependency summary only.
.RS
.RE
.TP
.B \f[CB]\-v\f[R] or \f[CB]\-verbose\f[R]
Prints all class\-level dependencies.
This is equivalent to
.RS
.RS
.PP
\f[CB]\-verbose:class\ \-filter:none\f[R]
.RE
.RE
.TP
.B \f[CB]\-verbose:package\f[R]
Prints package\-level dependencies excluding, by default, dependences
within the same package.
.RS
.RE
.TP
.B \f[CB]\-verbose:class\f[R]
Prints class\-level dependencies excluding, by default, dependencies
within the same archive.
.RS
.RE
.TP
.B \f[CB]\-apionly\f[R] or \f[CB]\-\-api\-only\f[R]
Restricts the analysis to APIs, for example, dependences from the
signature of \f[CB]public\f[R] and \f[CB]protected\f[R] members of public
classes including field type, method parameter types, returned type, and
checked exception types.
.RS
.RE
.TP
.B \f[CB]\-jdkinternals\f[R] or \f[CB]\-\-jdk\-internals\f[R]
Finds class\-level dependences in the JDK internal APIs.
By default, this option analyzes all classes specified in the
\f[CB]\-\-classpath\f[R] option and input files unless you specified the
\f[CB]\-include\f[R] option.
You can\[aq]t use this option with the \f[CB]\-p\f[R], \f[CB]\-e\f[R], and
\f[CB]\-s\f[R] options.
.RS
.PP
\f[B]Warning\f[R]: The JDK internal APIs are inaccessible.
.RE
.TP
.B \f[CB]\-cp\f[R] \f[I]path\f[R], \f[CB]\-classpath\f[R] \f[I]path\f[R], or \f[CB]\-\-class\-path\f[R] \f[I]path\f[R]
Specifies where to find class files.
.RS
.RE
.TP
.B \f[CB]\-\-module\-path\f[R] \f[I]module\-path\f[R]
Specifies the module path.
.RS
.RE
.TP
.B \f[CB]\-\-upgrade\-module\-path\f[R] \f[I]module\-path\f[R]
Specifies the upgrade module path.
.RS
.RE
.TP
.B \f[CB]\-\-system\f[R] \f[I]java\-home\f[R]
Specifies an alternate system module path.
.RS
.RE
.TP
.B \f[CB]\-\-add\-modules\f[R] \f[I]module\-name\f[R][\f[CB],\f[R] \f[I]module\-name\f[R]...]
Adds modules to the root set for analysis.
.RS
.RE
.TP
.B \f[CB]\-\-multi\-release\f[R] \f[I]version\f[R]
Specifies the version when processing multi\-release JAR files.
\f[I]version\f[R] should be an integer >=9 or base.
.RS
.RE
.TP
.B \f[CB]\-q\f[R] or \f[CB]\-quiet\f[R]
Doesn\[aq]t show missing dependencies from
\f[CB]\-generate\-module\-info\f[R] output.
.RS
.RE
.TP
.B \f[CB]\-version\f[R] or \f[CB]\-\-version\f[R]
Prints version information.
.RS
.RE
.SH MODULE DEPENDENCE ANALYSIS OPTIONS
.TP
.B \f[CB]\-m\f[R] \f[I]module\-name\f[R] or \f[CB]\-\-module\f[R] \f[I]module\-name\f[R]
Specifies the root module for analysis.
.RS
.RE
.TP
.B \f[CB]\-\-generate\-module\-info\f[R] \f[I]dir\f[R]
Generates \f[CB]module\-info.java\f[R] under the specified directory.
The specified JAR files will be analyzed.
This option cannot be used with \f[CB]\-\-dot\-output\f[R] or
\f[CB]\-\-class\-path\f[R] options.
Use the \f[CB]\-\-generate\-open\-module\f[R] option for open modules.
.RS
.RE
.TP
.B \f[CB]\-\-generate\-open\-module\f[R] \f[I]dir\f[R]
Generates \f[CB]module\-info.java\f[R] for the specified JAR files under
the specified directory as open modules.
This option cannot be used with the \f[CB]\-\-dot\-output\f[R] or
\f[CB]\-\-class\-path\f[R] options.
.RS
.RE
.TP
.B \f[CB]\-\-check\f[R] \f[I]module\-name\f[R] [\f[CB],\f[R] \f[I]module\-name\f[R]...]
Analyzes the dependence of the specified modules.
It prints the module descriptor, the resulting module dependences after
analysis and the graph after transition reduction.
It also identifies any unused qualified exports.
.RS
.RE
.TP
.B \f[CB]\-\-list\-deps\f[R]
Lists the module dependences and also the package names of JDK internal
APIs (if referenced).
This option transitively analyzes libraries on class path and module
path if referenced.
Use \f[CB]\-\-no\-recursive\f[R] option for non\-transitive dependency
analysis.
.RS
.RE
.TP
.B \f[CB]\-\-list\-reduced\-deps\f[R]
Same as \f[CB]\-\-list\-deps\f[R] without listing the implied reads edges
from the module graph.
If module M1 reads M2, and M2 requires transitive on M3, then M1 reading
M3 is implied and is not shown in the graph.
.RS
.RE
.TP
.B \f[CB]\-\-print\-module\-deps\f[R]
Same as \f[CB]\-\-list\-reduced\-deps\f[R] with printing a
comma\-separated list of module dependences.
The output can be used by \f[CB]jlink\ \-\-add\-modules\f[R] to create a
custom image that contains those modules and their transitive
dependences.
.RS
.RE
.TP
.B \f[CB]\-\-ignore\-missing\-deps\f[R]
Ignore missing dependences.
.RS
.RE
.SH OPTIONS TO FILTER DEPENDENCES
.TP
.B \f[CB]\-p\f[R] \f[I]pkg_name\f[R], \f[CB]\-package\f[R] \f[I]pkg_name\f[R], or \f[CB]\-\-package\f[R] \f[I]pkg_name\f[R]
Finds dependences matching the specified package name.
You can specify this option multiple times for different packages.
The \f[CB]\-p\f[R] and \f[CB]\-e\f[R] options are mutually exclusive.
.RS
.RE
.TP
.B \f[CB]\-e\f[R] \f[I]regex\f[R], \f[CB]\-regex\f[R] \f[I]regex\f[R], or \f[CB]\-\-regex\f[R] \f[I]regex\f[R]
Finds dependences matching the specified pattern.
The \f[CB]\-p\f[R] and \f[CB]\-e\f[R] options are mutually exclusive.
.RS
.RE
.TP
.B \f[CB]\-\-require\f[R] \f[I]module\-name\f[R]
Finds dependences matching the given module name (may be given multiple
times).
The \f[CB]\-\-package\f[R], \f[CB]\-\-regex\f[R], and \f[CB]\-\-require\f[R]
options are mutually exclusive.
.RS
.RE
.TP
.B \f[CB]\-f\f[R] \f[I]regex\f[R] or \f[CB]\-filter\f[R] \f[I]regex\f[R]
Filters dependences matching the given pattern.
If give multiple times, the last one will be selected.
.RS
.RE
.TP
.B \f[CB]\-filter:package\f[R]
Filters dependences within the same package.
This is the default.
.RS
.RE
.TP
.B \f[CB]\-filter:archive\f[R]
Filters dependences within the same archive.
.RS
.RE
.TP
.B \f[CB]\-filter:module\f[R]
Filters dependences within the same module.
.RS
.RE
.TP
.B \f[CB]\-filter:none\f[R]
No \f[CB]\-filter:package\f[R] and \f[CB]\-filter:archive\f[R] filtering.
Filtering specified via the \f[CB]\-filter\f[R] option still applies.
.RS
.RE
.TP
.B \f[CB]\-\-missing\-deps\f[R]
Finds missing dependences.
This option cannot be used with \f[CB]\-p\f[R], \f[CB]\-e\f[R] and
\f[CB]\-s\f[R] options.
.RS
.RE
.SH OPTIONS TO FILTER CLASSES TO BE ANALYZED
.TP
.B \f[CB]\-include\f[R] \f[I]regex\f[R]
Restricts analysis to the classes matching pattern.
This option filters the list of classes to be analyzed.
It can be used together with \f[CB]\-p\f[R] and \f[CB]\-e\f[R], which apply
the pattern to the dependencies.
.RS
.RE
.TP
.B \f[CB]\-P\f[R] or \f[CB]\-profile\f[R]
Shows the profile containing a package.
.RS
.RE
.TP
.B \f[CB]\-R\f[R] or \f[CB]\-\-recursive\f[R]
Recursively traverses all run\-time dependences.
The \f[CB]\-R\f[R] option implies \f[CB]\-filter:none\f[R].
If \f[CB]\-p\f[R], \f[CB]\-e\f[R], or \f[CB]\-f\f[R] options are specified,
only the matching dependences are analyzed.
.RS
.RE
.TP
.B \f[CB]\-\-no\-recursive\f[R]
Do not recursively traverse dependences.
.RS
.RE
.TP
.B \f[CB]\-I\f[R] or \f[CB]\-\-inverse\f[R]
Analyzes the dependences per other given options and then finds all
artifacts that directly and indirectly depend on the matching nodes.
This is equivalent to the inverse of the compile\-time view analysis and
the print dependency summary.
This option must be used with the \f[CB]\-\-require\f[R],
\f[CB]\-\-package\f[R], or \f[CB]\-\-regex\f[R] options.
.RS
.RE
.TP
.B \f[CB]\-\-compile\-time\f[R]
Analyzes the compile\-time view of transitive dependencies, such as the
compile\-time view of the \f[CB]\-R\f[R] option.
Analyzes the dependences per other specified options.
If a dependency is found from a directory, a JAR file or a module, all
classes in that containing archive are analyzed.
.RS
.RE
.SH EXAMPLE OF ANALYZING DEPENDENCIES
.PP
The following example demonstrates analyzing the dependencies of the
\f[CB]Notepad.jar\f[R] file.
.PP
\f[B]Linux and OS X:\f[R]
.IP
.nf
\f[CB]
$\ jdeps\ demo/jfc/Notepad/Notepad.jar
Notepad.jar\ \->\ java.base
Notepad.jar\ \->\ java.desktop
Notepad.jar\ \->\ java.logging
\ \ \ <unnamed>\ (Notepad.jar)
\ \ \ \ \ \ \->\ java.awt
\ \ \ \ \ \ \->\ java.awt.event
\ \ \ \ \ \ \->\ java.beans
\ \ \ \ \ \ \->\ java.io
\ \ \ \ \ \ \->\ java.lang
\ \ \ \ \ \ \->\ java.net
\ \ \ \ \ \ \->\ java.util
\ \ \ \ \ \ \->\ java.util.logging
\ \ \ \ \ \ \->\ javax.swing
\ \ \ \ \ \ \->\ javax.swing.border
\ \ \ \ \ \ \->\ javax.swing.event
\ \ \ \ \ \ \->\ javax.swing.text
\ \ \ \ \ \ \->\ javax.swing.tree
\ \ \ \ \ \ \->\ javax.swing.undo
\f[R]
.fi
.PP
\f[B]Windows:\f[R]
.IP
.nf
\f[CB]
C:\\Java\\jdk1.9.0>jdeps\ demo\\jfc\\Notepad\\Notepad.jar
Notepad.jar\ \->\ java.base
Notepad.jar\ \->\ java.desktop
Notepad.jar\ \->\ java.logging
\ \ \ <unnamed>\ (Notepad.jar)
\ \ \ \ \ \ \->\ java.awt
\ \ \ \ \ \ \->\ java.awt.event
\ \ \ \ \ \ \->\ java.beans
\ \ \ \ \ \ \->\ java.io
\ \ \ \ \ \ \->\ java.lang
\ \ \ \ \ \ \->\ java.net
\ \ \ \ \ \ \->\ java.util
\ \ \ \ \ \ \->\ java.util.logging
\ \ \ \ \ \ \->\ javax.swing
\ \ \ \ \ \ \->\ javax.swing.border
\ \ \ \ \ \ \->\ javax.swing.event
\ \ \ \ \ \ \->\ javax.swing.text
\ \ \ \ \ \ \->\ javax.swing.tree
\ \ \ \ \ \ \->\ javax.swing.undo
\f[R]
.fi
.SH EXAMPLE USING THE \-\-INVERSE OPTION
.IP
.nf
\f[CB]
\ $\ jdeps\ \-\-inverse\ \-\-require\ java.xml.bind
Inverse\ transitive\ dependences\ on\ [java.xml.bind]
java.xml.bind\ <\-\ java.se.ee
java.xml.bind\ <\-\ jdk.xml.ws
java.xml.bind\ <\-\ java.xml.ws\ <\-\ java.se.ee
java.xml.bind\ <\-\ java.xml.ws\ <\-\ jdk.xml.ws
java.xml.bind\ <\-\ jdk.xml.bind\ <\-\ jdk.xml.ws
\f[R]
.fi
